﻿using System.Drawing;
namespace ShpViewer
{
    class MyPoint
    {
        PointF point;
        public MyPoint()
        {
            point = new PointF();
        }
        public void Read(ExtendBinaryReader extendBinaryReader)
        {
            int recordNumber = extendBinaryReader.ReadInt32UsingBigEndian();
            int recordLength = extendBinaryReader.ReadInt32UsingBigEndian();
            int recordShapeType = extendBinaryReader.ReadInt32();
            point.X = (float)extendBinaryReader.ReadDouble();
            point.Y = 0 - (float)extendBinaryReader.ReadDouble();
        }
        public void Render(Graphics g, double xMin, double yMax, float scaleX, float scaleY)
        {
            int x = (int)((point.X - (float)xMin) * scaleX);
            int y = (int)((point.Y - (float)yMax) * scaleY);
            g.FillEllipse(Brushes.Green, x, y, 10, 10);
            g.DrawEllipse(Pens.Black, x, y, 10, 10);
            Image image = Image.FromFile("..\\..\\Images\\China.png");
            g.DrawImage(image, x - (int)(image.Width * 0.5), y - image.Height);
        }
    }
}
